/**
 * 
 */
package leetCode;

/**
 * @author zhong
 *
 */
public class LongPressedName {
	public boolean isLongPressedName(String name, String typed) {
		int n = name.length();
		int m = typed.length();
		int i = 0, j = 0;
		while (i < n && j < m) {
			if (name.charAt(i) == typed.charAt(j)) {
				i++;
				j++;
			} else {
				j++;
			}
		}
		return i == n && j == m;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String name = "vtkgn";
		String typed = "vttkgnn";
		System.out.println(new LongPressedName().isLongPressedName(name, typed));

	}

}
